<div class="row">
  <div class="col-md-3 wh-sidebar">

    {{#search/containers/search-facets
      counts=facetCounts
      selections=(readonly facetsSelections)
      onFacetsChange=(action onFacetsChange) as |searchFacet selections counts onFacetChange onFacetClear|}}

      {{#each searchFacet as |facet|}}
        {{search/search-facet
          facet=facet
          selections=(get selections facet.name)
          counts=(get counts facet.name)
          onChange=(action onFacetChange)
          onClear=(action onFacetClear)}}
      {{/each}}
    {{/search/containers/search-facets}}
  </div>
  <div class="col-md-9 wh-main-content">
    {{#if searchLoading}}
      {{pendulum-ellipsis-animation}}
    {{else}}
      <section class="search-results page-section-container nacho-container">
        {{#if model.count}}
          <div class="search-pagination">
            <ul class="pager" style="margin-top: 0">
              {{#unless first}}
                <li class="previous">
                  {{#link-to 'search'
                            (query-params category=category source=source page=previousPage)}}
                    &larr; Prev
                  {{/link-to}}
                </li>
              {{/unless}}
              <li>
                {{ model.count }} results - page {{ model.page }}
                of {{ model.totalPages }}
              </li>
              {{#unless last}}
                <li class="next">
                  {{#link-to 'search'
                            (query-params category=category source=source page=nextPage)}}
                    Next &rarr;
                  {{/link-to}}
                </li>
              {{/unless}}
            </ul>
          </div>
        {{/if}}
        {{#if model.count}}
          {{#if model.isFlowJob}}
            <table id="searchresults" class="search-results searchtable">
              <tbody>
                {{#each model.data as |flowJob|}}
                  <tr class="result">
                    <td class="col-xs-12">
                      <div class="dataset-info">
                        <i class="fa fa-random"></i>
                        <a href="{{flowJob.link}}">
                          {{flowJob.displayName}}
                        </a>
                      </div>
                      <p>{{ flowJob.path }}</p>
                      <p>source: {{ flowJob.appCode }}</p>
                      <div class="schematext"
                          style="margin-top:5px;margin-bottom: 10px;">
                        {{ flowJob.schema }}
                      </div>
                    </td>
                  </tr>
                {{/each}}
              </tbody>
            </table>
          {{else}}
            <table id="searchresults" class="search-results searchtable">
              <tbody>
                {{#each model.data as |dataset|}}
                  <tr class="result">
                    <td class="col-xs-12">
                      <div class="dataset-info">
                        {{#if model.isMetrics}}
                          <i class="fa fa-plus-square-o"></i>
                          {{#link-to 'metrics.metric' dataset.id}}
                            {{dataset.name}}
                          {{/link-to}}
                        {{else}}
                          <i class="fa fa-database"></i>
                          {{#link-to 'datasets.dataset' dataset.urn}}
                            {{dataset.name}}
                          {{/link-to}}
                        {{/if}}
                      </div>
                      <p>
                        {{ dataset.urn }}
                      </p>
                      {{#if dataset.source}}
                        <p>Data Platform: {{ dataset.source }}</p>
                      {{else}}
                        <p>source: Metric</p>
                      {{/if}}
                      <div class="schematext"
                          style="margin-top:5px;margin-bottom: 10px;">
                        {{ dataset.schema }}
                      </div>
                    </td>
                  </tr>
                {{/each}}
              </tbody>
            </table>
          {{/if}}
        {{else}}
          {{#if showNoResult}}
            <h4>No items found</h4>
          {{/if}}
        {{/if}}
      </section>
    {{/if}}
  </div>
</div>
